Exploring EuroLeague Basketball Team Performance, a Tidy Tuesdays Visualization

library(tidyverse)
library(plotly)

This project uses the tidyverse and plotly packages to explore relationships among EuroLeague basketball teams. The tidyverse is used for data cleaning and transformation, while plotly is used to create an interactive visualization that allows comparison across multiple team performance metrics.

euroleague_basketball <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2025/2025-10-07/euroleague_basketball.csv') |> 
  mutate(capacity = str_split(Capacity, ", ")) |> 
  unnest(capacity) |> 
  mutate(capacity = as.numeric(str_replace_all(capacity, ",", ""))) |> 
  mutate(lastrank = as.numeric(str_extract(`Last season`, "\\d+")),
         lastrank = ifelse(is.na(lastrank), 20, lastrank)) |> 
  select(Team, Country, capacity, lastrank, FinalFour_Appearances, Titles_Won, everything())

The dataset is imported directly from the TidyTuesday GitHub repository and contains information about EuroLeague basketball teams. This includes arena capacity, last season’s ranking, Final Four appearances, and titles won.

Several cleaning steps are performed to prepare the data for analysis or visualization. Arena capacity values are separated and converted into numeric format so they can be used in quantitative comparisons. The last season ranking is extracted as a numeric value from text, and teams with missing rankings are assigned a value of 20 to indicate a lower ranking position. The dataset is then reorganized to prioritize key variables relevant to team performance and infrastructure.

el_basket_plot <- euroleague_basketball[1:6] |> 
  mutate(
    team_id = as.numeric(factor(Team)),
    country_id = as.numeric(factor(Country))
  )

To prepare the data for visualization, numeric identifiers are created for both teams and countries. These identifiers allow categorical variables to be represented properly in the parallel coordinates plot. While the identifiers are numeric, they are only used to support visualization and correspond directly to team and country labels.

el_basket_plot |> 
plot_ly(
  type = 'parcoords',
  width = 800,
  height = 500,
  line = list(
    color = ~country_id,
    colorscale = 'Rainbow'
  ),
  dimensions = list(
    list(label = "Team", values = ~team_id,
         tickvals = unique(el_basket_plot$team_id),
         ticktext = unique(el_basket_plot$Team)),
    
    list(label = "Capacity", values = ~capacity),
    
    list(
      label = "Last Rank",
      values = ~21 - lastrank,
      tickvals = c(20, 16, 11, 6, 1),
      ticktext = c(1, 5, 10, 15, 20)
    ),
    
    list(
      label = "Final Fours",
      values = ~FinalFour_Appearances,
      tickvals = sort(unique(el_basket_plot$FinalFour_Appearances))
    ),
    list(
      label = "Titles",
      values = ~Titles_Won,
      tickvals = sort(unique(el_basket_plot$Titles_Won))
    )
  )
) |> 
layout(
  margin = list(l = 150, r = 50, t = 0, b = 50)
)

A parallel coordinates plot is created to visualize and compare multiple performance and infrastructure variables simultaneously. Each vertical axis represents a different variable, including arena capacity, last season ranking, Final Four appearances, and titles won. Each line represents a single team, allowing patterns and relationships across variables to be examined.

Teams are colored according to their country to show geographic trends and allow easier visual grouping. Using any of the vertical axes, click or drag to highlight the team lines that fit the given criteria. This interactive graph allows a visual comparison of specific EuroLeague teams.